//
// Created by xychen on 2022/1/18.
//

#include "labelednumber.h"

#include <QHBoxLayout>
#include <QLabel>
#include <QLCDNumber>

LabeledNumber::LabeledNumber(const QString &text, QWidget *parent) : QWidget(parent) {
    setAttribute(Qt::WA_TranslucentBackground, true);
    auto *layout = new QHBoxLayout();
    label = new QLabel(text);
    label->setAttribute(Qt::WA_TranslucentBackground, true);
    QFont ft;
    ft.setBold(true);
    ft.setPointSize(14);
    label->setFont(ft);

    number = new QLCDNumber();
    number->setAttribute(Qt::WA_TranslucentBackground, true);
    number->setSegmentStyle(QLCDNumber::Flat);
    layout->addWidget(label);
    layout->addWidget(number);
    setLayout(layout);
}
void LabeledNumber::setNumber(int new_value) {
    number->display(new_value);
}
